import axios from 'axios'

axios.interceptors.request.use(config => {
  const token = localStorage.getItem('token')

  if (token) {
    config.headers.authorization = `Bearer ${token}`
  }

  return config
})

axios.interceptors.response.use((config) => {
  return config
}, (err) => {
  return { data: { data: {} } }

})

export default axios
